/**
 * 
 */
package com.furschina.struts2;

import java.util.Collection;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;

import cn.wooshai.core.struts2.PaginationAware;
import cn.wooshai.core.vo.PageModel;

import com.furschina.model.Channel;
import com.furschina.service.ChannelService;
import com.furschina.vo.ChannelPage;

/**
 * @author iday
 * 
 */
@Controller
public class ChannelAction extends BaseAction implements PaginationAware {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7896454681680197952L;

	static Log LOG = LogFactory.getLog(ChannelAction.class);

	private Channel model;

	private ChannelPage pm;

	private Collection<Channel> list;

	private String id;

	private ChannelService channelService;

	/**
	 * @param model
	 *            the model to set
	 */
	public void setModel(Channel model) {
		this.model = model;
	}

	/**
	 * @return the model
	 */
	public Channel getModel() {
		return model;
	}

	@Override
	public void setPage(int i) {
		this.pm.setPage(i);

	}

	@Override
	public PageModel getPm() {
		return this.pm;
	}

	/**
	 * @param list
	 *            the list to set
	 */
	public void setList(Collection<Channel> list) {
		this.list = list;
	}

	/**
	 * @return the list
	 */
	public Collection<Channel> getList() {
		return list;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param channelService
	 *            the channelService to set
	 */
	public void setChannelService(ChannelService channelService) {
		this.channelService = channelService;
	}

	/**
	 * @return the channelService
	 */
	public ChannelService getChannelService() {
		return channelService;
	}

	/*
	 * ================================================
	 */
	public String index() {
		list = channelService.queryAll(pm);
		return INDEX;
	}

	public String show() {
		this.model = this.channelService.findByPrimaryKey(id);
		return SHOW;
	}

//	public String create() {
//		this.channelService.create(model);
//		return SUCCESS;
//	}
//
//	public String update() {
//		this.channelService.update(model);
//		return SUCCESS;
//	}

	public String include() {
		this.list = channelService.queryAll(pm);
		return null;
	}
}
